﻿using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RsaRegister.Model
{
    public class SoftInfo
    {
        [SugarColumn(IsPrimaryKey = true, IsIdentity = false,Length =36)]
        public Guid SoftId { get; set; }
        [SugarColumn(Length =50)]
        public string SoftName { get; set; }
        [SugarColumn(Length = 32)]
        public string LastVersion { get; set; }
        [SugarColumn(Length = 916)]
        public string PriKey { get; set; }
        [SugarColumn(Length = 100)]
        /// <summary>
        /// 下载地址，如果有多个地址，则用;分隔
        /// </summary>
        public string DownloadAddress { get; set; }
        //https://gitee.com/ccjungle/Download/blob/master/NeeqDoc/ConferenceDocumentor.msi

        public DateTime LastUpdated { get; set; }
        [SugarColumn(IsIgnore =true)]
        public string PubKey { get {
                if (string.IsNullOrEmpty(PriKey)) return "";
            return PriKey.Substring(0, PriKey.IndexOf("<P>")) + "</RSAKeyValue>";
            } }
        [SugarColumn(IsIgnore = true)]
        public string[] DownloadAddressList
        {
            get
            {
                return DownloadAddress.Split(new string[] { "///" }, StringSplitOptions.RemoveEmptyEntries);
            }
        }

    }
}
